home *** CD-ROM | disk | FTP | other *** search
- #ifdef RCSID
- static char RcsId[] = "@(#)$Revision: 1.1 $";
- #endif
- /*
- $Header: /pita/work/HDF/dev/RCS/test/annotations/gen2Dfloat.c,v 1.1 90/04/19 11:12:56 mfolk beta $
-
- $Log: gen2Dfloat.c,v $
- * Revision 1.1 90/04/19 11:12:56 mfolk
- * Initial revision
- *
- */
- #include <stdio.h>
- #include <math.h>
-
- /****************************************************************
- **
- ** gen2Dfloat: generate 2-D data array for turning into image
- ** plus max, min, and cross-hatching
- **
- ****************************************************************/
- int
- gen2Dfloat(height, width, data, max, min)
- int height, width;
- float *data, *max, *min;
- {
- int i, j, gap;
- float *pdata;
-
- *min = 0.0;
- *max = height;
-
- /* store one value per row, increasing by one for each row */
- pdata = data;
- for (i=0; i< height; i++)
- for (j=0; j< width; j++)
- *pdata++ = (float) i+1;
-
- /* generate cross-hatching -- one row/col of 0's every 10th row/col */
- /* rows */
- pdata = data;
- gap = height/10;
- for (i=0; i<height; i += gap) {
- pdata = data + i*width;
- for (j=0; j<width; j++)
- *pdata++ = 0.0;
- }
- /* cols */
- pdata = data;
- gap = width/10;
- for (i=0; i<height; i++) {
- pdata = data + i*width;
- for (j=0; j<width; j += gap, pdata += gap) {
- *pdata = 0.0;
- }
- }
- }
-
-